<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="UTF-8">
	<title>红酒会 - 智能红酒管家</title>
	<link rel="shortcut icon" type="image/x-icon" href="${ctx}/favicon.ico" />
	<link type="text/css" rel="stylesheet" href="${ctx}/static/styles/bootstrap.min.css" />
</head>
<body>
	
	<c:import url="/header"><c:param name="module">vintry</c:param></c:import>
	<c:import url="/talk/right" />
	
	<div class="outWrap">
		<div class="spekBoxIn entde">
			<div class="alert alert-success">
	 				<p>请选择您感兴趣的标签，以便更好的体验！</p>
			</div>
			
			<form id="form" class="form-horizontal" action="${ctx}/user/tag/save" method="post">
				<div class="control-group">
					<c:set var="flag" value="0" />
					<c:forEach var="tag" items="${tagList}">
						<c:if test="${tag.type != flag}"><br/><div style="height:3px;"></div></c:if>
						<a href="javascript:void(0)" onclick="changeTags('${tag.id}')">
							<span class="label" id="tag${tag.id}" val="${tag.id},">${tag.name}</span></a>
						<c:set var="flag" value="${tag.type}" />
					</c:forEach>
					<input type="hidden" id="tags" name="tags" />
				</div>
				<div class="control-group">
			    	<div class="controls">
			      		<a href="javascript:void(0)" onclick="saveTag()"
			      			class="btn btn-info">&nbsp;&nbsp;&nbsp;提&nbsp;&nbsp;&nbsp;交&nbsp;&nbsp;&nbsp;</a>
			    	</div>
			  	</div>
			</form>
		</div>
	</div>
	
	<script type="text/javascript">
		function changeTags(tagId) {
			var tag = $('#tag' + tagId);
			if('label' == tag.attr('class')) {
				tag.addClass('label-info');
			}else {
				tag.removeClass('label-info');
			}
		}
		function saveTag() {
			var tags = '';
			$('span.label-info').each(function() {
				tags += $(this).attr('val');
			});
			$('#tags').val(tags);
			$('#form').submit();
		}
	</script>
</body>
</html>